package com.atguigu.gulimall.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

// 开启动态代理，使用aspectj作动态代理
@EnableAspectJAutoProxy(exposeProxy = true) // 对外暴露代理对象
// 开启rabbit监听（不监听可以不加）
@EnableRabbit
// 开启SpringSession
@EnableRedisHttpSession
// 开启服务注册功能
@EnableDiscoveryClient
// 开启feign
@EnableFeignClients
// 扫描mapper
@MapperScan("com.atguigu.gulimall.order.dao")
// 扫描组件
@ComponentScan(basePackages = {"com.atguigu.common.utils", "com.atguigu.gulimall.order"})
// springboot启动类注解
@SpringBootApplication
/*
* seata控制分布式事务:
* 1)、每一个微服务先必须创建undo_ log;
* 2)、安装事务协调器; seata-server: https ://github. com/seata/seata/releases
* 3)、整合
    1、导入依赖spring-cloud-starter-alibaba-seata seata-all-0.7.1
    2、解压并启动seata-server;
        registry.conf:注册中心配置;修改registry
        type=nacos
        file. conf:
    3、所有想要用到分布式事务的微服务使用seata DataSourceProxy代理 自己的数据源
    4、每个微服务，都必须导入
        registry. conf
        file.conf
    6、给分布式大事务的入口标注 @GLobalTransactional
    7、每一个远程的小事务用 @Transactional
 */
public class GulimallOrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallOrderApplication.class, args);
    }

}
